package com.stack;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @Author: linKe
 * @Date: 2022/1/1 21:12
 * @FileName: LinkedStackTest
 * @version: 1.0
 * @Description: 描述
 */
public class LinkedStackTest {

    LinkedStack<Integer> stack;

    @Before
    public void setUp() throws Exception {
        stack = new LinkedStack<Integer>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
    }

    @Test
    public void isEmpty() {
        boolean empty = stack.isEmpty();
        System.out.println(empty);
        // false
    }

    @Test
    public void push() {
        stack.push(4);
        Integer peek = stack.peek();
        System.out.println(peek);
        // 1
    }

    @Test
    public void peek() {
        Integer peek = stack.peek();
        System.out.println(peek);
        // 1 第一个插入的元素
    }

    @Test
    public void pop() {
        Integer pop = stack.pop();
        System.out.println(pop);
        // 3 最后插入的元素
    }
    @Test
    public void toStringTest(){
        System.out.println(stack.toString());
        //com.stack.LinkedStack,com.linearList.SinglyList@2b05039f
    }

}